//
//  Sr2ViewController.swift
//  edu
//
//  Created by karlzhou on 15/11/5.
//  Copyright © 2015年 karlzhou. All rights reserved.
//

import UIKit

class Sr2ViewController: UIViewController {
    
    //var  currentPlayVC : KrVideoPlayerController!
    var playListVC : ZTViewController!
    var movieModel : Sr2Model?
    let titles = ["简介","目录","相关推荐","跟帖"];
    
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        

        
        APIClient.getMovieDetail({
            (data:Sr2Model) -> Void in
            
            self.movieModel =  data
            print(data.title)
            print((self.movieModel?.videoList[0].repovideourlmp4)!)
            self.playVideo((self.movieModel?.videoList[0].repovideourlmp4)!)
            let vc1 = BaseListController<VideoList>.self
            let  playlist = MoviePlayListController.self
            let vcclass  = [vc1,playlist,vc1,vc1]
            
            
            
            self.playListVC = ZTViewController(mneuViewStyle: MenuViewStyleLine)
            [self.playListVC .currentController()]
            self.playListVC.loadVC(vcclass, andTitle: self.titles)
            self.addChildViewController(self.playListVC)
            self.playListVC.view.frame = CGRectMake(0, 340, self.view.frame.size.width, self.view.frame.size.height-420)
            
            self.view.addSubview(self.playListVC.view)
            
            }, failure: {
                (code :Int , message:String) -> Void in
                
        })
        
        
    }
    
    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
    }
    
    
    func playVideo(url: String){
        
        //let contentURL = NSURL(string: url)
        //self.addVideoPlayer(contentURL!)
    }
    /*
    func addVideoPlayer(url:NSURL){
        if (self.currentPlayVC == nil) {
            
            self.currentPlayVC = KrVideoPlayerController(frame: CGRectMake(0,20,self.view.frame.size.width,300))
            
            self.currentPlayVC.view.backgroundColor = UIColor.blackColor()
            
            
            self.currentPlayVC.dimissCompleteBlock = {() -> Void in
                self.currentPlayVC = nil
            }
            
            self.currentPlayVC.willBackOrientationPortrait = {() -> Void in
                
            }
            
            
            
            self.currentPlayVC.willChangeToFullscreenMode = {() -> Void in
                
            }
            
            
            self.view.addSubview(self.currentPlayVC.view)
            
        }
        self.currentPlayVC.contentURL = url;
        
    }
    */
    
}
